package com.hundsun.fcp.common.utils;

import android.graphics.Paint;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;

public class ImageUtil {
	/**
	 * 生成图片
	 */
	public static ShapeDrawable createBackground(int color, float radius){
		return createBackground(color, 255, radius);
	}
	
	/**
	 * 生成图片
	 */
	public static ShapeDrawable createBackground(int color, int alpha, float radius){
		float[] outerR = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };
		RoundRectShape roundRectShape = new RoundRectShape(outerR, null, null);
        ShapeDrawable shapeDrawable = new ShapeDrawable(roundRectShape);
        shapeDrawable.getPaint().setColor(color);
        shapeDrawable.getPaint().setAlpha(alpha);
        shapeDrawable.getPaint().setStyle(Paint.Style.FILL);
        return shapeDrawable;
	}
	
}
